import { request } from "@/utils/service"
import type * as Projects from "./types"

/** 增 */
export function createProjectsApi(data: Projects.CreateOrUpdateProjectsRequestData) {
  return request({
    url: "projects",
    method: "post",
    data
  })
}

/** 删 */
export function deleteProjectsApi(id: string) {
  return request({
    url: `projects/${id}`,
    method: "delete"
  })
}

/** 改 */
export function updateProjectsApi(data: Projects.CreateOrUpdateProjectsRequestData) {
  return request({
    url: "projects/" + data.id,
    method: "put",
    data
  })
}

/** 查 */
export function getProjectsApi(params: Projects.GetProjectsRequestData) {
  return request<Projects.GetProjectsResponseData>({
    url: "projects",
    method: "get",
    params
  })
}

/** 查详情 */
export function getProjectsDetailApi(id: string) {
  return request<Projects.GetProjectsResponeseDetailData>({
    url: `projects/${id}`,
    method: "get"
  })
}
